/**
 * 类似vuex里面的 action
 */

import store from "@/store"
import { getUserList } from "@/api/user"


/**
 * 获取数据列表
 */
export const get_user_list = async ()=>{
    let { user:{page,size} } = store.getState(); 
    // 获取后端返回的数据
    let { list, total } = await getUserList(page, size);
    // 设置数据给仓库
    store.dispatch({ type: "USER_SET_LIST", payload: list })
    store.dispatch({ type: "USER_SET_TOTAL", payload: total })
}
